<template>
    <div>
      <h2 class="demo">姓名：{{ name }}</h2>
      <h2>age{{ age }}</h2>
      
    </div>
</template>
  
  
  
<script>
  export default {
      name:'You',
      data(){
          return {
              name:'李四',
              age:18
          }
      },
      methods:{
          hi1(){
            console.log('hi1')
          },
          hi2(name){
            console.log('hi2,i am ',name)
          }
      },
      mounted(){
        this.$bus.$on('hi1',this.hi1)
        this.$bus.$on('hi2',this.hi2)
      }
  }
</script>

<style scoped>
  .demo {
    color: blue;
  }
</style>
  